package com.ruoyi.project.system.question.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.system.question.mapper.QuestionCategoryMapper;
import com.ruoyi.project.system.question.domain.QuestionCategory;
import com.ruoyi.project.system.question.service.IQuestionCategoryService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 题目分类Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-07-15
 */
@Service
public class QuestionCategoryServiceImpl implements IQuestionCategoryService 
{
    @Autowired
    private QuestionCategoryMapper questionCategoryMapper;

    /**
     * 查询题目分类
     * 
     * @param id 题目分类主键
     * @return 题目分类
     */
    @Override
    public QuestionCategory selectQuestionCategoryById(Long id)
    {
        return questionCategoryMapper.selectQuestionCategoryById(id);
    }

    /**
     * 查询题目分类列表
     * 
     * @param questionCategory 题目分类
     * @return 题目分类
     */
    @Override
    public List<QuestionCategory> selectQuestionCategoryList(QuestionCategory questionCategory)
    {
        return questionCategoryMapper.selectQuestionCategoryList(questionCategory);
    }

    /**
     * 新增题目分类
     * 
     * @param questionCategory 题目分类
     * @return 结果
     */
    @Override
    public int insertQuestionCategory(QuestionCategory questionCategory)
    {
        questionCategory.setCreateTime(DateUtils.getNowDate());
        return questionCategoryMapper.insertQuestionCategory(questionCategory);
    }

    /**
     * 修改题目分类
     * 
     * @param questionCategory 题目分类
     * @return 结果
     */
    @Override
    public int updateQuestionCategory(QuestionCategory questionCategory)
    {
        questionCategory.setUpdateTime(DateUtils.getNowDate());
        return questionCategoryMapper.updateQuestionCategory(questionCategory);
    }

    /**
     * 批量删除题目分类
     * 
     * @param ids 需要删除的题目分类主键
     * @return 结果
     */
    @Override
    public int deleteQuestionCategoryByIds(Long[] ids)
    {
        return questionCategoryMapper.deleteQuestionCategoryByIds(ids);
    }

    /**
     * 删除题目分类信息
     * 
     * @param id 题目分类主键
     * @return 结果
     */
    @Override
    public int deleteQuestionCategoryById(Long id)
    {
        return questionCategoryMapper.deleteQuestionCategoryById(id);
    }

    @Override
    public List<QuestionCategory> selectAllQuestionCategoryList() {
        return questionCategoryMapper.selectAllQuestionCategoryList();
    }
}